/**
 * Created by liu on 2018/1/3.
 */


import axios from '../../../api/api';
import { post } from '../../../api/myAxios';
import { getListData } from  '../../../utils/page';


export const getUsers = (_this) => {
    getListData(users, _this);
};

export const users = params => {
    return axios.get(`/api/user/list`, params)
        .then(user => {
            return user.data
        })
};

export const getUser = params => {
    return axios.get(`/api/user/detail?id=`+params)
        .then(user => user.data)
};

export const edit = params => {
    let param = {
        url:'/api/user/edit',
        data: params
    };
    return post(param).then(data => data)
};

export const create = params => {
    let param = {
        url:'/api/user/add',
        data: params
    };
    return post(param).then(data => data)
};

export const remove = params => {
    let param = {
        url:'/api/user/delete',
        data: {id:params}
    };
    return post(param)
};


export const login = params => {
    let param = {
        url:'/api/user/login',
        data: params
    };
    return post(param)
};
